package controller

import (
	"fmt"
	"wsRouter/net"
)

var DefaultAccount = &Account{}

type Account struct {
}

func (a *Account) Router(r *net.Router) {
	g := r.Group("account")
	g.AddRouter("login", a.login)
}

type Person struct {
	Name string `json:"name"`
	Age  int    `json:"age"`
}

func (a *Account) login(req *net.WsMsgReq, rsp *net.WsMsgRsp) {
	fmt.Println("login", req, rsp)
	person := Person{Name: "Bob", Age: 25}
	rsp.Body.Msg = person
	rsp.Body.Code = 200
}
